
const TokenKey = 'Token'
const UserKey  = 'User'
const RoleKey  = 'Role'

export function getToken() {
  return localStorage.getItem(TokenKey)
}

export function setToken(token) {
  return localStorage.setItem(TokenKey, token)
}

export function removeToken() {
  return localStorage.removeItem(TokenKey)
}

export function getUserInfo(){
    return JSON.parse(localStorage.getItem(UserKey));
}

export function setUserInfo(userinfo){
    return localStorage.setItem(UserKey, JSON.stringify(userinfo))

}

export function removeUserInfo(){
    localStorage.removeItem(UserKey)
}


export function getUserRole(){
  return JSON.parse(localStorage.getItem(RoleKey));
}

export function setUserRole(role){
  return localStorage.setItem(RoleKey, JSON.stringify(role))
}

export function removeUserRole(){
  localStorage.removeItem(RoleKey)
}

export function removeCache(){
  localStorage.clear();
}